import java.util.Stack;

public class L150 {
    public static void main(String[] args) {
        String[] strings = {"10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"};
        int i = new Solution().evalRPN(strings);
        System.out.println(i);
    }


    static class Solution {
        public int evalRPN(String[] tokens) {
            Stack<Integer> stack = new Stack<>();
            for (String token : tokens) {
                if ("+".equals(token)) {
                    Integer pop = stack.pop();
                    Integer pop1 = stack.pop();
                    stack.push(pop + pop1);
                } else if ("-".equals(token)) {
                    Integer pop = stack.pop();
                    Integer pop1 = stack.pop();
                    stack.push(pop1 - pop);
                } else if ("*".equals(token)) {
                    Integer pop = stack.pop();
                    Integer pop1 = stack.pop();
                    stack.push(pop1 * pop);
                } else if ("/".equals(token)) {
                    Integer pop = stack.pop();
                    Integer pop1 = stack.pop();
                    stack.push(pop1 / pop);
                } else {
                    stack.push(Integer.valueOf(token));
                }
            }
            return stack.pop();
        }
    }
}
